import React, { Component } from 'react';
import {connect} from "react-redux";

import {createIncrementAction} from "../../redux/count_action.js";

class Count extends Component {
    add=()=>{
        this.props.add(1);
    };
    render() {
        return (
            <div>
                <h2>当前求和为：{this.props.result}</h2>
                <button onClick={this.add}>点我加1</button>
            </div>
        );
    };
};

export default connect(
    (state)=>{
        return{
            result:state
        };
    },
    {
        add:createIncrementAction
    }
)(Count);
